﻿/**
 * @file FITKNastranAdaptorMAT1.h
 * @author zhourp (zhourunping@diso.cn)
 * @brief the class of adaptor for mat1 command
 * @date 2024-11-14
 */
#ifndef FITKNASTRANADAPTORMAT1_H
#define FITKNASTRANADAPTORMAT1_H

#include "FITKNastranAbstractAdaptor.h"

#include "FITK_Component/FITKAbaqusData/FITKAbaqusPart.h"
#include "FITK_Component/FITKAbaqusData/FITKDataCase.h"
#include "FITK_Interface/FITKInterfaceModel/FITKComponentManager.h"
#include "FITK_Interface/FITKInterfacePhysics/FITKSectionAssign.h"
#include "FITK_Interface/FITKInterfaceStructural/FITKAbaMaterial.h"
#include "FITK_Interface/FITKInterfaceStructural/FITKAbaMaterialBehavior.h"
#include "FITK_Interface/FITKInterfaceStructural/FITKAbaMaterialDamping.h"
#include "FITK_Interface/FITKInterfaceStructural/FITKAbaMaterialDensity.h"
#include "FITK_Interface/FITKInterfaceStructural/FITKAbaMaterialElastic.h"
#include "FITK_Interface/FITKInterfaceStructural/FITKAbaMaterialExpansion.h"
#include "FITK_Interface/FITKInterfaceStructural/FITKAbaMeshPartVTK.h"
#include "FITK_Interface/FITKInterfaceStructural/FITKAbaSectionBeam.h"
#include "FITK_Interface/FITKInterfaceStructural/FITKAbaSectionShellHomogeneous.h"
#include "FITK_Kernel/FITKAdaptor/FITKIOAdaptorFactory.h"
#include "FITK_Kernel/FITKAppFramework/FITKMessage.h"

#include <QQueue>
#include <QString>

namespace Nastran
{
/**
 * @brief the class of adaptor for mat1 command
 * 
 * @author: zhourp (zhourunping@diso.cn)
 * @date: 2024-11-14
 */
class FITKNastranAdaptorMAT1 : public FITKNastranAbstractAdaptor
{
  public:
    explicit FITKNastranAdaptorMAT1() = default;
    virtual ~FITKNastranAdaptorMAT1();

    /**
     * @brief 适配器读取
     * @return 状态 true成功， false失败
     * @author zhourp (zhourunping@diso.cn)
     * @date 2024-03-15
     */
    bool adaptR() override;

    /**
     * @brief 适配器写入
     * @return 状态 true成功， false失败
     * @author shenzhuowei (2931275006@qq.com)
     * @date 2025-03-04
     */
    bool adaptW() override;

    /**
     * @brief Assigns the provided FITKDataCase object to the _caseData member variable.
     * @param[in] caseData Pointer to the FITKDataCase object to be assigned.
     * @author zhourp(zhourunping@diso.cn)
     * @date 2024-11-14
     */
    void setCaseData(AbaqusData::FITKDataCase *caseData);

    /**
     * @brief Set the file content cache for the FITKNastranAdaptorMAT1 class.
     * @param[in] cache The cache to be assigned to the class's file content cache.
     * @author zhourp(zhourunping@diso.cn)
     * @date 2024-11-14
     */
    void setFileContentCache(QQueue<QString> cache);

    /**
    * @brief 获取缓存队列
    * @param 缓存队列引用
    * @author shenzhuowei (2931275006@qq.com)
    * @date 2025-03-05
    */
    void getFileContentCache(QQueue<QString>& cache);
private:

    /**
    * @brief double转字符串 空格在右边
    * @param d double数据
    * @param prec 对double的有效字符数
    * @param width1 字符宽度
    * @param f 表示科学计数法或xxx
    * @return 转换后的字符
    * @author shenzhuowei (2931275006@qq.com)
    * @date 2025-03-05
    */
    QString Value2StringLeft(double d, int prec = 8, int width1 = 8, char f = 'g');

private:
    /**
     * @brief 算例数据
     * @author zhourp (zhourunping@diso.cn)
     * @date 2024-03-15
     */
    AbaqusData::FITKDataCase *_caseData{};

    /**
     * @brief 文件窗口数据
     * @author zhourp (zhourunping@diso.cn)
     * @date 2024-03-15
     */
    QQueue<QString> _fileContentCache{};
};

Register2FITKIOAdaptorFactory(BDF, Interface::FITKAbaMaterial, FITKNastranAdaptorMAT1)
} // namespace Nastran

#endif // FITKNASTRANADAPTORMAT1_H
